﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AirManager.Entities;
using FluentNHibernate.Mapping;

namespace AirManager.Repository
{
    public class PilotMap : ClassMap<Pilot>
    {
        public PilotMap()
        {
            Id(x => x.Id).Column("PilotID").GeneratedBy.Identity();
            Map(x => x.Nome).Column("Nome").Length(200).Not.Nullable();
            HasManyToMany(m => m.Fleets)
                .Table("FleetPilot")
                .ChildKeyColumn("FleetID")
                .ParentKeyColumn("PilotID")
                .Cascade.All()
                .Cascade.SaveUpdate()
                .Cascade.Delete();           
             
        }
  
    }
}
